package com.mingyuan.nacos;


import com.alibaba.nacos.api.naming.NamingFactory;
import com.alibaba.nacos.api.naming.NamingService;

import java.net.InetAddress;



public class NacosDemo {


    public static void main(String[] args) {
        try {
            String ip =  InetAddress.getLocalHost().getHostAddress();
            NamingService namingService1 = NamingFactory.createNamingService("150.158.78.193:8848");
            namingService1.registerInstance("nacos-demo", ip, 8080);
            System.out.println(ip+"已经成功注册！");
            System.in.read();
        }catch (Exception e){
            System.out.println("注册异常"+e.getMessage());
            e.printStackTrace();
        }




    }
}
